<?php 
/*
 module:		用户列表
 create_time:	2021-03-04 10:03:40
 author:		
 contact:		
*/

namespace app\admin\controller\Insurance;

use app\admin\service\Insurance\InsuranceUsersService;
use app\admin\model\Insurance\InsuranceUsers as InsuranceUsersModel;
use app\admin\controller\Admin;
use think\facade\Db;

class InsuranceUsers extends Admin {


	/*首页数据列表*/
	function index(){
		if (!$this->request->isAjax()){
			return view('index');
		}else{
			$limit  = $this->request->post('limit', 20, 'intval');
			$offset = $this->request->post('offset', 0, 'intval');
			$page   = floor($offset / $limit) +1 ;

			$where = [];
			$where['mobile'] = ['like',$this->request->param('mobile', '', 'serach_in')];

			$order  = $this->request->post('order', '', 'serach_in');	//排序字段 bootstrap-table 传入
			$sort  = $this->request->post('sort', '', 'serach_in');		//排序方式 desc 或 asc

			$field = 'id,mobile,sfzzm,sfzfm,xszzm,xszfm,plate_no,name,card_type,id_card';
			$orderby = ($sort && $order) ? $sort.' '.$order : 'id desc';

			$res = InsuranceUsersService::indexList(formatWhere($where),$field,$orderby,$limit,$page);
			return json($res);
		}
	}



}

